<?php
use lib\dao\Dao;

class DaoCompra extends Dao{
	
	
	function getEventoCompra(\lib\model\Model $M, \lib\dao\query\Query $Q){

		$table = $this->getTable($M);
		$query = $Q->prepare($M)->query;

		$sql   = "SELECT e.*,l.nombre as nombreLugar FROM $table c 
				join ticket t on (c.ticket_id=t.id)
				join evento e on (t.evento_id=e.id)
				join lugar l on (e.lugar_id=l.id)
	  		  	$query";

		//esto tambien lo puedo sacar de result
		$binds = $Q->binds;
		$Dar   = $this->DataAccess->retrieve($sql, $binds);
		return $Dar->fetchAll();
	}
	
	
}